package main

import (
	"github.com/Sir-yuChen/funAnalyse/core"
	"github.com/Sir-yuChen/funAnalyse/global"
	"github.com/Sir-yuChen/funAnalyse/initialize"
	"github.com/Sir-yuChen/funAnalyse/initialize/timer"
	_ "github.com/Sir-yuChen/funAnalyse/service/timer"
	"go.uber.org/zap"
)

func main() {
	global.GVA_VP = core.Viper() // 初始化Viper 读取yaml配置文件
	global.GVA_LOG = core.Zap()  // 初始化zap日志库
	zap.ReplaceGlobals(global.GVA_LOG)
	global.GVA_DB = initialize.Gorm() // gorm连接数据库
	//initialize.DBList()               //初始化 多数据库
	global.GVA_CASBIN = initialize.InitCasbin() //初始化权限
	timer.CronTimerInit()                       //初始化定时任务
	core.RunWindowsServer()
	defer func() {
		db, _ := global.GVA_DB.DB()
		defer db.Close() // 程序结束前关闭数据库链接
	}()
}
